#include "viewmodelfactory.h"

#include <QMessageBox>

BaseViewModel *ViewModelFactory::createViewModel(const std::string &viewModelName)
{
    // 这里后面要用反射实现
    if(viewModelName == "LoginViewModel"){
        return new LoginViewModel();
    }else if(viewModelName == "MainViewModel"){
        return new MainViewModel();
    }else if(viewModelName == "NetworkViewModel"){
        return new NetworkViewModel();
    }else if(viewModelName == "SquareWaveViewModel"){
        return new SquareWaveViewModel();
    }else{
        QMessageBox::information(nullptr,"结束","结束");
        exit(-1);
    }
}

ViewModelFactory &ViewModelFactory::instance()
{
    static ViewModelFactory vmf;
    return vmf;
}
